<?php 
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\captcha\Captcha;
/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\LoginForm */

$this->title = '有试吗';
//$this->params['breadcrumbs'][] = $this->title;

/* @var $this \yii\web\View */
/* @var $content string */

//AppAsset::register($this);
$this->title = '登录';

$fieldOptions1 = [
    'options' => ['class' => 'form-group has-feedback'],
    'inputTemplate' => "{input}<span class='glyphicon glyphicon-envelope form-control-feedback'></span>"
];

$fieldOptions2 = [
    'options' => ['class' => 'form-group has-feedback'],
    'inputTemplate' => "{input}<span class='glyphicon glyphicon-lock form-control-feedback'></span>"
];

$fieldOptions3 = [
    'options' => ['class' => 'form-group has-feedback'],
];

?>
<style>
#loginform-verifycode-verifycode{width:62%;}
.checkcode{ position:relative;}
.checkcode img{ border: 1px solid #ccc;border-radius: 4px; width:100px; height:34px; position:absolute; right:0px; bottom:0px; background:#ccc;}

</style>
<div class="login-box">
    <div class="login-logo">
        <a href="#"><b><?=Yii::$app->name?></b></a>
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
        <p class="login-box-msg">登录</p>

        <?php $form = ActiveForm::begin(['id' => 'login-form', 'enableClientValidation' => false]); ?>

        <?= $form
            ->field($model, 'username', $fieldOptions1)
            ->label(false)
            ->textInput(['placeholder' => $model->getAttributeLabel('username')]) ?>

        <?= $form
            ->field($model, 'password', $fieldOptions2)
            ->label(false)
            ->passwordInput(['placeholder' => $model->getAttributeLabel('password')]) ?>
          
          <?= $form
          ->field($model, 'verifyCode', ['options' => ['class' => 'form-group has-feedback']])
          ->label(false)
          ->widget(Captcha::className(),[
                   'template' => "<div class='checkcode'>{input}{image}</div>",
                   'imageOptions' => ['alt' => '验证码'],
                   //'captchaAction' => 'site/captcha',
            ]); 
          ?>
        <div class="row">
            <!-- /.col -->
            <div class="col-xs-12">
                <?= Html::submitButton('登录', ['class' => 'btn btn-primary btn-block btn-flat', 'name' => 'login-button']) ?>
            </div>
            <!-- /.col -->
        </div>
        <?php ActiveForm::end(); ?>

    </div>
    <!-- /.login-box-body -->
</div><!-- /.login-box -->